{extend name='extra@admin/content'}

{block name="button"}
    <div class="nowrap pull-right" style="margin-top:10px">
        {if auth("kuguan/materialpeifang/create_jinhuo_peifang_order")}
            <button data-modal='{:url("kuguan/materialpeifang/create_jinhuo_peifang_order")}?type=1' data-title="配方进货" class='layui-btn layui-btn-small'>
                <i class='fa fa-plus'></i> 配方进货
            </button>
        {/if}
        {if auth("store/material/create_jinhuo_order")}
            <button data-modal='{:url("store/material/create_jinhuo_order")}?type=1' data-title="原料进货" class='layui-btn layui-btn-small'>
                <i class='fa fa-plus'></i> 原料进货
            </button>
        {/if}
        <!--{if !empty($list)}-->
            <!--{if auth("store/export/export_material")}-->
            <!--<a href='{:url("store/export/export_material")}?name={$Think.get.name}&cate_1={$Think.get.cate_1}&cate_2={$Think.get.cate_2}&cate_3={$Think.get.cate_3}' class="layui-btn layui-btn-small" style="text-decoration:none"><i class="fa fa-mail-forward"></i>-->
                <!--导出-->
            <!--</a>-->
            <!--{/if}-->
        <!--{else /}-->
            <!--<a href="javascript:;" onclick="no_export();" class="layui-btn layui-btn-small " style="text-decoration:none;"><i class='fa fa fa-mail-forward'></i> 导出原料</a>-->
        <!--{/if}-->
    </div>
{/block}

{block name="content"}

<!-- 表单搜索 开始 -->
<form class="animated form-search" action="__SELF__" onsubmit="return false" method="get">
    <div class="col-xs-2">
        <div class="form-group">
            <select name="cate_1"  lay-filter="export" class="input-sm form-control">
                <option value="">- 选择一级分类 -</option>
                {foreach category_one as $v1}
                <option value="{$v1.name}" {if $Think.get.cate_1 eq $v1.id} selected {/if}>{$v1.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="col-xs-2">
        <div class="form-group">
            <select name="cate_2"  lay-filter="export" class="input-sm form-control">
                <option value="">- 选择二级分类 -</option>
                {foreach category_two as $v2}
                <option value="{$v2.name}" {if $Think.get.cate_2 eq $v2.id} selected {/if}>{$v2.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="col-xs-2">
        <div class="form-group">
            <select name="cate_3"  lay-filter="export" class="input-sm form-control">
                <option value="">- 选择三级分类 -</option>
                {foreach category_three as $v3}
                <option value="{$v3.name}" {if $Think.get.cate_3 eq $v3.id} selected {/if}>{$v3.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">材料名称</label>
        <div class="layui-input-inline">
            <input name="name" value="{$Think.get.name|default=''}" placeholder="请输入材料名称" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>

</form>
<!-- 表单搜索 结束 -->

<form onsubmit="return false;" data-auto="true" method="post">
    {if empty($list)}
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    {else}
    <input type="hidden" value="resort" name="action"/>
    <table class="layui-table" lay-skin="line" lay-size="sm">
        <thead>
            <tr>
                <th class='list-table-check-td'>
                    <input data-none-auto="" data-check-target='.list-check-box' type='checkbox'/>
                </th>
                <th class='text-left nowrap'>物料编码</th>
                <th class='text-left nowrap'>条码</th>
                <th class='text-left nowrap'>材料名称</th>
                <th class='text-left nowrap'>标准售价</th>
                <th class='text-left nowrap'>单位</th>
                <th class='text-left nowrap'>库存</th>
                <th class='text-left nowrap'>安全库存</th>
                <th class='text-left nowrap'>添加时间</th>
            </tr>
        </thead>
        <tbody>
            {foreach $list as $key=>$vo}
            {if condition="$vo.stock lt $vo.warn_stock"}
            <tr>
                <td class='list-table-check-td'>
                    <input class="list-check-box" value='{$vo.id}' type='checkbox'/>
                </td>
                <td class='text-left nowrap'>
                    {$vo.code}
                </td>
                <td class='text-left nowrap'>
                    {$vo.tiaoma}
                </td>
                <td class='text-left nowrap'>
                    {$vo.name}
                </td>
                <td class='text-left nowrap'>
                    {$vo.price}
                </td>
                <td class='text-left nowrap'>
                    {$vo.unit}
                </td>
                <td class='text-left nowrap'>
                    <span style="color:red;">{$vo.stock}</span>
                </td>
                <td class='text-left nowrap'>
                    {$vo.warn_stock}
                </td>
                <td class='text-left nowrap'>
                    {$vo.addtime|date="Y-m-d",###}
                </td>
            </tr>
            {/if}
            {/foreach}
        </tbody>
    </table>
    {if isset($page)}<p>{$page}</p>{/if}
    {/if}
    <script>
        window.laydate.render({range: true, elem: '#range-date', format: 'yyyy/MM/dd'});
    </script>
</form>
{/block}